import { ElMessage } from 'element-plus';

export function copyText(str: string) {
  const clipboard = navigator.clipboard || {
    writeText: (text) => {
      const copyInput = document.createElement('textarea');
      copyInput.value = text;
      document.body.appendChild(copyInput);
      copyInput.select();
      document.execCommand('copy');
      document.body.removeChild(copyInput);
    },
  };
  if (clipboard) {
    clipboard.writeText(str);
  }
}

export const getPointByTemperature = (temperature: number) => {
  if (temperature <= 0.3) return 2;
  if (temperature <= 0.7) return 4;
  if (temperature <= 1.1) return 6;
  if (temperature <= 1.5) return 8;
  return 8;
};
